// Balance Test
// Andrew Gooch
// Yale University
// July 2018


// This does a balance test pre-analysis to make sure randomization worked
// mlogit used with same covariates as treatment effect model
// output is means, standard devaiations, and the results of an F-test from the mlogit model
// Results are in the appendix Table 1

// location of data -> be sure to replace directory location with your own directory before running!
cd "C:\Users\agooch\Dropbox\Working papers\War with China\data"
use War_with_China_Experiment_Gooch_cleaned
cd "C:\Users\agooch\Dropbox\Working papers\War with China\code"


mlogit treatment Democrats Independents Turnout_VLikely Turnout_SLikely Northeast Midwest West Female Education Age AA Hispanic 
testparm Democrats Independents Turnout_VLikely Turnout_SLikely Northeast Midwest West Female Education Age AA Hispanic 
// p value = .23
cd "C:\Users\agooch\Dropbox\Working papers\War with China\results"
outsum Democrats Independents Turnout_VLikely Turnout_SLikely Northeast Midwest West Female Education Age AA Hispanic if treatment==1 using "Balance_MeansSDs_War.out" , replace ctitle ("Control") bracket addnote("F test p value: 0.23" )
outsum Democrats Independents Turnout_VLikely Turnout_SLikely Northeast Midwest West Female Education Age AA Hispanic if treatment==2 using "Balance_MeansSDs_War.out" , append ctitle ("Cue") bracket
outsum Democrats Independents Turnout_VLikely Turnout_SLikely Northeast Midwest West Female Education Age AA Hispanic if treatment==3 using "Balance_MeansSDs_War.out" , append ctitle ("Inevitable") bracket
outsum Democrats Independents Turnout_VLikely Turnout_SLikely Northeast Midwest West Female Education Age AA Hispanic if treatment==4 using "Balance_MeansSDs_War.out" , append ctitle ("Human Rights") bracket
